﻿using _5E.Infrastructure.UnitOfWork;
using NHibernate;
using NHibernate.Criterion;
using WholesaleOnline.Model;

namespace WholesaleOnline.Repository
{
    public class BuyerNewProductRepository : BuyerNotOrderProductRepository
    {
        public BuyerNewProductRepository(IUnitOfWork uow) : base(uow) { }

        protected override void AppendFindProductsQueryOver(IQueryOver<WoBuyerProduct, WoProduct> queryOver)
        {
            queryOver.Where(bp => bp.IsNew == true);
        }

        protected override void AppendFindCategoryIdsConjunction(NHibernate.Criterion.Conjunction andSubQuery)
        {
            base.AppendFindCategoryIdsConjunction(andSubQuery);
            andSubQuery.Add(Restrictions.Eq("bp.IsNew", true));
        }
    }
}
